package com.aaa.java08;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2022/7/11 16:13
 * @description：父类
 * @modified By：
 * @version: 1.0
 */
public class Father {
    private int id;
    String name;


    public Father() {
        System.out.println("父类无参的构造器被调用了");
    }

    public Father(int id, String name) {
        this.id = id;
        this.name = name;
        System.out.println("父类有参的构造器被调用了");
    }

    public void work(){
        System.out.println("上班挣钱10000");
    }

    protected    Number add(int a,int b) throws ArrayIndexOutOfBoundsException  {
        System.out.println("父类的加法函数被调用了");
        return a+b;
    }

    public void eat(){
        System.out.println("吃饭");
    }

    public static void main(String[] args) {
        Father father = new Father();
        father.id=123;
        father.name="father";
        father.eat();
        father.work();
    }
}
